package com.mydesignpattern.beijing.observer;

import java.util.ArrayList;
import java.util.List;

public class QQGroupImpl implements QQGroup {

    private List<Person> personList = new ArrayList<Person>();

    private String message ;



    @Override
    public void addGroup(Person person) {
        this.personList.add(person);
    }

    /**
     * 群主发言
     * @param message
     */
    public void setMessage(String message) {
        this.message = message;
        for(Person p:personList){
            p.receiveMessage(message);
        }

    }
}
